/*    */ package dm.sql;
/*    */ 
/*    */ import dm.jdbc.dbaccess.Const;
/*    */ import dm.jdbc.dbaccess.DBError;
/*    */ import dm.jdbc.innerData.DmdbConnAgent;
/*    */ import java.sql.SQLException;
/*    */ import java.sql.Struct;
/*    */ import java.util.Map;
/*    */ import java.util.ResourceBundle;
/*    */ 
/*    */ public class STRUCT extends TypeData implements Struct
/*    */ {
/*    */   StructDescriptor m_strctDesc;
/*    */   TypeData[] m_attribs;
/*    */   int m_objCount;
/*    */   int m_strCount;
/*    */   
/*    */   public STRUCT(TypeData[] atData, TypeDescriptor desc)
/*    */   {
/* 20 */     super(null, null);
/* 21 */     this.m_strctDesc = new StructDescriptor(desc);
/* 22 */     this.m_attribs = atData;
/*    */   }
/*    */   
/*    */   public TypeData[] getAttribsTypeData() {
/* 26 */     return this.m_attribs;
/*    */   }
/*    */   
/*    */   public STRUCT(StructDescriptor desc, DmdbConnAgent connAgent, Object[] objArr) throws SQLException
/*    */   {
/* 31 */     super(null, null);
/*    */     
/* 33 */     if ((desc == null) || (objArr == null)) {
/* 34 */       DBError.throwSQLException(6036);
/*    */     }
/* 36 */     if ((connAgent == null) || (connAgent.getRealConn().isClosed())) {
/* 37 */       throw new SQLException(
/* 38 */         Const.res.getString("error.connectionClosedOrNotBuild"));
/*    */     }
/* 40 */     if ((desc.getSize() != objArr.length) && (desc.getObjId() != 4)) {
/* 41 */       throw new SQLException(
/* 42 */         Const.res.getString("error.structMemNotMatch"));
/*    */     }
/* 44 */     this.m_strctDesc = desc;
/* 45 */     this.m_attribs = TypeData.toStruct(objArr, this.m_strctDesc.m_typeDesc);
/*    */   }
/*    */   
/*    */   public String getSQLTypeName() throws SQLException {
/* 49 */     return this.m_strctDesc.m_typeDesc.getFulName();
/*    */   }
/*    */   
/*    */   public Object[] getAttributes() throws SQLException {
/* 53 */     return toJavaArray(this);
/*    */   }
/*    */   
/*    */   public Object[] getAttributes(Map map) throws SQLException {
/* 57 */     Object[] objs = getAttributes();
/* 58 */     if ((map == null) || (map.size() == 0)) {
/* 59 */       return objs;
/*    */     }
/* 61 */     for (int i = 0; i < objs.length; i++) {
/* 62 */       if ((objs[i] instanceof STRUCT)) {
/* 63 */         STRUCT struct = (STRUCT)objs[i];
/* 64 */         objs[i] = dm.jdbc.dataConvertion.CType2JType.getStruct_SQLData(map, struct, 
/* 65 */           struct.getSQLTypeName());
/*    */       }
/*    */     }
/*    */     
/* 69 */     return objs;
/*    */   }
/*    */   
/*    */   private void checkCol(int col) throws SQLException {
/* 73 */     if ((col < 1) || (col > this.m_attribs.length)) {
/* 74 */       DBError.throwSQLException(6032);
/*    */     }
/*    */   }
/*    */   
/*    */   TypeData getAttrValue(int col) throws SQLException {
/* 79 */     checkCol(col);
/*    */     
/* 81 */     return this.m_attribs[(col - 1)];
/*    */   }
/*    */ }


/* Location:              D:\Program Files\DBMS_20150813\jdbc\Dm7JdbcDriver17.jar!\dm\sql\STRUCT.class
 * Java compiler version: 2 (46.0)
 * JD-Core Version:       0.7.1
 */